#include <bits/stdc++.h>
using namespace std;
const int _ = 5e5 + 10;
const int __ = 2e6 + 10;
const int ___ = 1e7 + 10;
const int ____ = 3e7 + 10;
int n, m, B, cnt, xl[_], yl[_], xr[_], yr[_];
bool del[_];
int cntp, ls[___], rs[___], cnte;
int shd[___], thd[___], nx[____], to[____];
int insinv(int p, int id, int l, int r, int L, int R) {
    if (!p) p = ++cntp;
    if (l == L && r == R) {
        cnte++;
        nx[cnte] = thd[p];
        to[cnte] = id;
        thd[p] = cnte;
    } else {
        cnte++;
        nx[cnte] = shd[p];
        to[cnte] = id;
        shd[p] = cnte;
        int M = ((L + R) >> 1);
        if (r <= M) {
            ls[p] = insinv(ls[p], id, l, r, L, M);
        } else if (l > M) {
            rs[p] = insinv(rs[p], id, l, r, M+1, R);
        } else {
            ls[p] = insinv(ls[p], id, l, M, L, M);
            rs[p] = insinv(rs[p], id, M+1, r, M+1, R);
        }
    }
    return p;
}
int getinv(int p, int l, int r, int L, int R) {
    if (!p) return 0;
    while (thd[p] && del[to[thd[p]]]) {
        thd[p] = nx[thd[p]];
    }
    if (thd[p]) {
        return to[thd[p]];
    }
    if (l == L && r == R) {
        while (shd[p] && del[to[shd[p]]]) {
            shd[p] = nx[shd[p]];
        }
        if (shd[p]) {
            return to[shd[p]];
        } else {
            return 0;
        }
    } else {
        int M = ((L + R) >> 1);
        if (r <= M) {
            return getinv(ls[p], l, r, L, M);
        } else if (l > M) {
            return getinv(rs[p], l, r, M+1, R);
        } else {
            int id = getinv(ls[p], l, M, L, M);
            if (id) return id;
            return getinv(rs[p], M+1, r, M+1, R);
        }
    }
}
int segrt[__], tagrt[__];
#define ls ((p)<<1)
#define rs (((p)<<1)|1)
#define M (((L)+(R))>>1)
void insseg(int p, int id, int ll, int rr, int l, int r, int L, int R) {
    if (l == L && r == R) {
        tagrt[p] = insinv(tagrt[p], id, ll, rr, 1, m);
    } else {
        segrt[p] = insinv(segrt[p], id, ll, rr, 1, m);
        if (r <= M) {
            insseg(ls, id, ll, rr, l, r, L, M);
        } else if (l > M) {
            insseg(rs, id, ll, rr, l, r, M+1, R);
        } else {
            insseg(ls, id, ll, rr, l, M, L, M);
            insseg(rs, id, ll, rr, M+1, r, M+1, R);
        }
    }
}
int getseg(int p, int ll, int rr, int l, int r, int L, int R) {
    int id = getinv(tagrt[p], ll, rr, 1, m);
    if (id) return id;
    if (l == L && r == R) {
        return getinv(segrt[p], ll, rr, 1, m);
    } else {
        if (r <= M) {
            return getseg(ls, ll, rr, l, r, L, M);
        } else if (l > M) {
            return getseg(rs, ll, rr, l, r, M+1, R);
        } else {
            int jd = getseg(ls, ll, rr, l, M, L, M);
            if (jd) return jd;
            return getseg(rs, ll, rr, M+1, r, M+1, R);
        }
    }
}
#undef M
#undef rs
#undef ls
inline int getsrect(int xL, int yL, int xR, int yR) {
    xL = max(xL, 1);
    yL = max(yL, 1);
    xR = min(xR, n);
    yR = min(yR, m);
    if (xL <= xR && yL <= yR) {
        return getseg(1, yL, yR, xL, xR, 1, n);
    } else {
        return 0;
    }
}
inline int getrect(int xL, int yL, int xR, int yR) {
    int id = getsrect(xL - 2, yL, xL - 2, yR);
    if (id) return id;
    id = getsrect(xL - 1, yL - 1, xL - 1, yR + 1);
    if (id) return id;
    id = getsrect(xL, yL - 2, xR, yR + 2);
    if (id) return id;
    id = getsrect(xR + 1, yL - 1, xR + 1, yR + 1);
    if (id) return id;
    return getsrect(xR + 2, yL, xR + 2, yR);
}
inline void pushrect(int xL, int yL, int xR, int yR) {
    cnt++;
    xl[cnt] = xL;
    yl[cnt] = yL;
    xr[cnt] = xR;
    yr[cnt] = yR;
    insseg(1, cnt, yL, yR, xL, xR, 1, n);
}
inline void poprect(int id) {
    del[id] = true;
}
inline void inspoint(int x, int y) {
    int xL = x, yL = y, xR = x, yR = y;
    while (true) {
        int id = getrect(xL, yL, xR, yR);
        if (!id) break;
        poprect(id);
        xL = min(xL, xl[id]);
        yL = min(yL, yl[id]);
        xR = max(xR, xr[id]);
        yR = max(yR, yr[id]);
    }
    pushrect(xL, yL, xR, yR);
}
inline long long area(void) {
    long long ans = 0LL;
    for (int i = 1; i <= cnt; i++) {
        if (!del[i]) {
            ans += ((long long) (xr[i] - xl[i] + 1)) * ((long long) (yr[i] - yl[i] + 1));
        }
    }
    return ans;
}
int main() {
    freopen("grid.in", "r", stdin);
    freopen("grid.out", "w", stdout);
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin >> n >> m >> B;
    while (B--) {
        int x, y;
        cin >> x >> y;
        inspoint(x, y);
    }
    cout << area() << endl;
    return 0;
}